﻿//-----------------------------------------------------------------------
// <copyright file="LocalizablePropertiesFromXML.cs" company="INL sprl">
//     Copyright 2009-2010 INL sprl.
// </copyright>
//-----------------------------------------------------------------------

namespace ParseXAML
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml;
    using System.Xml.Serialization;

    public class ListProperties : SerializableDictionary<string, LocalizableControl>
    {
        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;

            ListProperties p = obj as ListProperties;
            if (p == null)
                return false;

            return (BaseIO<ListProperties>.ToXmlString(this) == BaseIO<ListProperties>.ToXmlString(p));
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }

    /// <summary>
    /// Classe qui permet d'obtenir les propriétés des controls à traduire
    /// </summary>
    [XmlRoot(ElementName = "Localizable")]
    public class LocalizablePropertiesFromXML
    {
        /// <summary>
        /// Initializes a new instance of the LocalizableControls class.
        /// </summary>
        /// <remarks>
        /// Constructeur nécessaire à cause la sérialization XML
        /// </remarks>
        public LocalizablePropertiesFromXML()
        {
            this.IncludeProperties = new ListProperties();
            this.ExcludeProperties = new ListProperties();
        }

        /// <summary>
        /// Gets or sets le dictionnaire qui contient les propriétés à inclure
        /// </summary>
        [XmlElement(ElementName = "Include")]
        public ListProperties IncludeProperties { get; set; }

        /// <summary>
        /// Gets or sets le dictionnaire qui contient les propriétés à exclure
        /// </summary>
        [XmlElement(ElementName = "Exclude")]
        public ListProperties ExcludeProperties { get; set; }

    }
}
